// enum Option<T> {
//     Some(T),
//     None,
// }

fn plus_one(x: Option<i32>) ->Option<i32> {
    match x {
        None => None,
        Some(x) => Some(x+1),
    }
}
fn main() {
    let some_number = Some(5);
    let some_string = Some(String::from("a String"));
    let absent_nubmer: Option<i32> = None;

    let x: i32 = 5;
    let y: Option<i32> = Some(6);
    let mut temp = 1;
    match y {
        Some(i) => { temp = i; }
        None => { println!("do nothing"); }
    }

    let sum = x + temp; 
    println!("sum = {}", sum);

    let result = plus_one(y);
    match result {
        Some(i) => println!("result = {}", i),
        None => println!("nothing"),
    }

    if let Some(value) = plus_one(y) {
        println!("value = {:?}", value);
    } else {
        println!("do nothing!");
    }
    println!("Hello, world!");
}
